package com.coocaa.internship.service.serviceImpl;

import com.coocaa.internship.common.ResultData;
import com.coocaa.internship.dao.CityDao;
import com.coocaa.internship.pojo.City;
import com.coocaa.internship.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 城市信息查询业务实现类
 * @Author: zwh
 * @Date: 2019-07-30
 * @Time: 23:18
 */
@Service
public class CityServiceImpl implements CityService {
    @Autowired
    CityDao cityDao;

    @Override
    public ResultData selectByProvinceId(Long provinceId) {
        List<City> cities = cityDao.selectAllCitiesByProvinceId(provinceId);
        if (!cities.isEmpty()) {
            return ResultData.success(cities);
        }
        return ResultData.failed();
    }
}
